home *** CD-ROM | disk | FTP | other *** search
Wrap
/* MultiUpload.thor by Troels Walsted Hansen ** $VER: MultiUpload.thor v2.00 (01.11.94) ** ** An ARexx script that'll make it easier to upload one file to ** many BBSs. Supports (AmiNet) filename.readme description files. ** If no .readme file is around, the script will attempt to obtain ** a short description from the filecomment of the file. ** ** New: · filecomment reading added by request :-) ** · This version is only for THOR v2.0 or higher. */ options results /* needs THOR and bbsread.library functions */ p = ' ' || address() || ' ' || show('P',,) thorport = pos(' THOR.',p) if thorport > 0 then thorport = word(substr(p,thorport+1),1) else do say 'No THOR port found!' exit 10 end if ~show('p', 'BBSREAD') then do address command "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead" "WaitForPort BBSREAD" end drop EVENT. EVENT.FILEDESCR = "" /* main stuff */ address(bbsread) GETGLOBALDATA STEM GLOBALDATA address(thorport) THORTOFRONT REQUESTFILE TITLE '"Select file to upload:"' ID '"'GLOBALDATA.UPLOADPATH'"' FP PAT '"#?"' if(rc ~= 0) then exit EVENT.LOCALFILE = result lastchar = right(EVENT.LOCALFILE,1) if(lastchar = "/" | lastchar = ":" | EVENT.LOCALFILE = "") then do REQUESTNOTIFY TEXT '"No file selected!"' BT '"_Ok"' exit end /* check filename length here!!! GETBBSTYPEDATA stem BBSTYPEDATA if(lenght(EVENT.LOCALFILE) > BBSTYPEDATA.FILENAMELEN) then do REQUESTSTRING TITLE '"Reduce number of characters in filename to 'BBSTYPEDATA.FILENAMELEN||"' ID '"'EVENT.LOCALFILE'"' BT '"_Ok|_Cancel"' MAXCHARS BBSTYPEDATA.FILENAMELEN if(rc ~= 0) then exit else EVENT.FILENAME = result end */ posi = lastpos("/",EVENT.LOCALFILE) if(posi = 0) then posi = lastpos(":",EVENT.LOCALFILE) EVENT.FILENAME = substr(EVENT.LOCALFILE,posi+1) readmefile = substr(EVENT.LOCALFILE, 1, lastpos(".",EVENT.LOCALFILE))||"readme" if exists(readmefile) then do call open(ReadMe, readmefile) do while(~eof(ReadME) & EVENT.FILEDESCR = "") Line = readln(ReadMe) if(upper(substr(Line,1,6)) = "SHORT:") then EVENT.FILEDESCR = strip(substr(Line,8), B) end call close(ReadMe) end else drop readmefile if(EVENT.FILEDESCR = "") then do address command 'list '||'"'||EVENT.LOCALFILE||'"'||' lformat="%C" >t:TempFilecommentFile' call open(tfh,"t:TempFilecommentFile", R) EVENT.FILEDESCR = readln(tfh) call close(tfh) address command "delete >nil: t:TempFilecommentFile" end if(EVENT.FILEDESCR = "") then do REQUESTSTRING TITLE '"'||'Enter description for '|| EVENT.FILENAME||'"' BT '"_Ok|_Cancel"' MAXCHARS 40 EVENT.FILEDESCR = result if(rc ~= 0) then exit end REQUESTNOTIFY TEXT '"Do you wish to upload to BBSs from a list?"' BT '"_Yes|_No"' if(result = 0) then do REQUESTNOTIFY TEXT '"Enable private to conference uploading?"' BT '"_Yes|_No"' AskForConfname = result address(bbsread) GETBBSLIST stem BBSLIST if(rc ~= 0) then do address(thorport) REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"' exit 5 end address(thorport) REQUESTLIST instem BBSLIST outstem USERBBSLIST title '"Select BBSs:"' DRAGSELECT MULTISELECT SIZEGADGET if(rc ~= 0) then break else bbs = result do i=1 to USERBBSLIST.COUNT if(AskForConfname) then do address(bbsread) GETCONFLIST '"'USERBBSLIST.i'"' CONFLIST if(rc ~= 0) then do address(thorport) REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"' exit 5 end address(thorport) REQUESTLIST instem CONFLIST title '"Select conference at ' || USERBBSLIST.i || ':' || '"' SIZEGADGET if(rc ~= 0) then break else EVENT.CONFERENCE = result end else drop EVENT.CONFERENCE address(bbsread) if(readmefile ~= "READMEFILE") then do UNIQUEMSGFILE bbsname '"'USERBBSLIST.i'"' stem UNIQUEFILE if(rc ~= 0) then do address(thorport) REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"' exit end address command 'copy >nil: ' || '"' || readmefile || '"' || ' TO ' || UNIQUEFILE.NAME EVENT.DETAILEDFILEDESCR = UNIQUEFILE.FILEPART end WRITEBREVENT bbsname '"'USERBBSLIST.i'"' event 5 stem EVENT if(rc ~= 0) then do address(thorport) REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"' exit 5 end else do address(thorport) PACKEVENTS '"'USERBBSLIST.i'"' end end end else do REQUESTFILE TITLE '"Select MultiUpload list file:"' ID '"THOR:Rexx/PostingLists"' FP configfile = result lastchar = right(configfile,1) if(rc~=0 | lastchar = "/" | lastchar = ":" | configfile = "") then exit call open(cf, configfile, R) do forever call readln(cf) bbs = substr(readln(cf),6) if(bbs = "") then break EVENT.CONFERENCE = substr(readln(cf),7) if(EVENT.CONFERENCE = "") then drop EVENT.CONFERENCE address(bbsread) if(readmefile ~= "READMEFILE") then do UNIQUEMSGFILE bbsname '"'bbs'"' stem UNIQUEFILE if(rc ~= 0) then do address(thorport) REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"' exit end address command 'copy >nil: ' || '"' || readmefile || '"' || ' TO ' || UNIQUEFILE.NAME EVENT.DETAILEDFILEDESCR = UNIQUEFILE.FILEPART end WRITEBREVENT bbsname '"'bbs'"' event 5 stem EVENT if(rc ~= 0) then do address(thorport) REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"' exit 5 end else do address(thorport) PACKEVENTS '"'bbs'"' end end call close(cf) end RESCAN exit k